package cn.sanshuilin.kst.system.provider.bean;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Date;

/**
 * @author greenlee
 * @version v1.0
 * @create 创建时间: 2017-12-03 18:31
 * Copyright 2017  by 三水林科技有限公司
 **/
@Entity
@Table(name = "Favorite")
public class Favorite implements Serializable {
    private String id;
    private String productId;
    private Date pubDate;
    private String pubMemberId;

    private Member pubMember;



    @Transient
    public Member getPubMember() {
        return pubMember;
    }

    public void setPubMember(Member pubMember) {
        this.pubMember = pubMember;
    }

    @Id
    @Column(name = "ID", nullable = false, length = 255)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "ProductID", nullable = true, length = 255)
    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    @Basic
    @Column(name = "PubDate", nullable = true)
    public Date getPubDate() {
        return pubDate;
    }

    public void setPubDate(Date pubDate) {
        this.pubDate = pubDate;
    }

    @Basic
    @Column(name = "PubMemberID", nullable = true, length = 255)
    public String getPubMemberId() {
        return pubMemberId;
    }

    public void setPubMemberId(String pubMemberId) {
        this.pubMemberId = pubMemberId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Favorite that = (Favorite) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (productId != null ? !productId.equals(that.productId) : that.productId != null) return false;
        if (pubDate != null ? !pubDate.equals(that.pubDate) : that.pubDate != null) return false;
        if (pubMemberId != null ? !pubMemberId.equals(that.pubMemberId) : that.pubMemberId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (productId != null ? productId.hashCode() : 0);
        result = 31 * result + (pubDate != null ? pubDate.hashCode() : 0);
        result = 31 * result + (pubMemberId != null ? pubMemberId.hashCode() : 0);
        return result;
    }
}
